<?php
namespace jy_meye;
defined('BY_JYA') or exit('error');
/*
	工具类
*/
class model extends \plugin{
	public function get_area_code($area,$district=false,$street=false){
		$address=$area['province'];
		if($area['city']){
			$address.=' '.$area['city'];
		}
		if($area['district'] && $district){
			$address.=' '.$area['district'];
		}
		if($area['street'] && $street){
			$address.=' '.$area['street'];
		}
		$area_code=pdo_getcolumn('core_area',array('address'=>$address),'code');
		$data=array(
			'area_code'=>$area_code,
			'address'=>$address,
			'title'=>$area['street'],
		);
		return $data;
	}
}